﻿namespace SampleApplication.CoffeeShopSample.Implementation.Application.CommandsParsers
{
    #region Usings

    using Dependencies.Application;
    using Domain;
    using System;

    #endregion Usings

    public class ExitCommandParser : ICommandParser
    {
        private readonly ExitCommand exitCommand;

        public ExitCommandParser(ExitCommand exitCommand)
        {
            if (exitCommand == null)
            {
                throw new ArgumentNullException("exitCommand");
            }

            this.exitCommand = exitCommand;
        }

        public ICommand Parse(string command)
        {
            return "3".Equals(command) ? exitCommand : null;
        }
    }
}